// Status Komentar
function latestComments(a){if(document.getElementById('status-forum')){var b,lk,sm,sc,tt,ot,sk="",ct=document.getElementById('status-forum');sk='<ul>';for(var i=0;i<7;i++){b=a.feed.entry[i];if(i==a.feed.entry.length)break;for(var k=0;k<b.link.length;k++){if(b.link[k].rel=='alternate'){lk=b.link[k].href;break}}if("content"in b){sm=b.content.$t}else if("summary"in b){sm=b.summary.$t}else{sm=""}ot=lk.replace(/-/g," ").substring(lk.lastIndexOf('/')+1,lk.lastIndexOf('.'));ot=ot[0].toUpperCase()+ot.slice(1);if(sm.indexOf('@<a href="')!=-1){sm=sm.replace(/@<a href=\"#c([0-9]+)\" rel=\"nofollow\">(.*?)<\/a>(.*)/ig,"membalas <a href=\"#c$1\">$2<\/a>");tt=sm.replace(/<a.*[^>]>(.*?)<\/a>/g,"$1")}else{tt=sm="menulis komentar/memulai diskusi"}sk+='<li title="'+b.author[0].name.$t+' '+tt+' di &quot;'+ot+'&quot;"><strong><a href="'+lk+'">'+b.author[0].name.$t+'</a></strong> '+sm+' di '+ot+'</li>'}sk+='</ul>';ct.innerHTML=sk}}
// Latest Code Snippet
function recentSnippet(a){if(document.getElementById('latest-snippet-container')){var b=a.feed.entry,c,sk="",ct=document.getElementById('latest-snippet-container');sk='<div class="snippet-outer"><strong>Snippet Terakhir</strong><ul>';for(var i=0;i<7;i++){for(var j=0;j<b[i].link.length;j++){if(b[i].link[j].rel=='alternate'){c=b[i].link[j].href;break}}sk+='<li>&#10070; <a href="'+c+'" title="'+b[i].title.$t+'">'+b[i].title.$t+'</a></li>'}sk+='</ul></div>';ct.innerHTML=sk}}
// Updated Posts
function updatedPosts(a) {
    var e = a.feed.entry,
        tt, im, lk, cm, dt, sk = "",
        ct = document.getElementById('updated-posts-container');
    for (var i = 0; i < 7; i++) {
        for (var j = 0; j < 7; j++) {
            if (e[i].link[j].rel == 'alternate') {
                lk = e[i].link[j].href;
                break;
            }
        }
        for (var l = 0; l < 7; l++) {
            if (e[i].link[l].rel == "replies" && e[i].link[l].type == "text/html") {
                cm = e[i].link[l].title;
                break;
            }
        }
        var tt = e[i].title.$t,
            pd = e[i].published.$t.substring(0, 10),
            dt = pd.replace(/-/g, "/");
        if ("media$thumbnail" in e[i]) {
            im = e[i].media$thumbnail.url;
        } else {
            im = "http://4.bp.blogspot.com/-nX7a45LPhlk/Uwm9vSQFIOI/AAAAAAAABhk/KWNznW9bjIY/s1600/Logo+Ardy+Template+-+Blogger+Templates+SEO+Friendly.png";
        }
        sk += '<li><img src="' + im.replace(/\/s72-c/, "\/s40-c") + '" class="rp-thumb" alt="thumb"/>';
        sk += '<strong><a href="' + lk + '" target="_parent">' + tt + '</a></strong><span class="footer-outer"><span class="dt">' + dt + '</span><span class="cm"> - ' + cm + '</span></span></li>';
    }
    ct.style.height = "420px";
    ct.innerHTML = sk;
}
// Callback Script
function getScript(url) {
    var s = document.createElement('script');
    s.type = "text/javascript";
    s.src = url;
    document.body.appendChild(s);
}
getScript("http://firman-ardy.blogspot.com/feeds/posts/summary?alt=json-in-script&orderby=updated&max-results=7&callback=updatedPosts");
getScript("http://firman-ardy.blogspot.com/feeds/posts/summary?alt=json-in-script&orderby=published&max-results=7&callback=recentSnippet");
getScript("http://firman-ardy.blogspot.com/feeds/comments/default?alt=json-in-script&max-results=7&callback=latestComments");